package dw.common;

import java.io.Serializable;
import java.util.List;

public abstract class GenericServiceImpl<T, ID extends Serializable, EX extends Exception>
    implements GenericService<T, ID, EX> {

  public abstract GenericDao<T, ID> getRepository();

  public void delete(ID id) throws EX {
    getRepository().delete(id);
  }
  
  public void delete(T t) throws EX {
    getRepository().delete(t);
  }

  public List<T> findAll() {
    return getRepository().findAll();
  }

  public T findById(ID id) {
    return getRepository().findById(id);
  }

  public List<T> findByIds(String propertyNameOfId, List<ID> collectionOfIds) {
    return getRepository().findByIds(propertyNameOfId, collectionOfIds);
  }
  
  public List<T> findByExample(T t) {
    return getRepository().findByExample(t);
  }

  public void saveOrUpdate(T t) throws EX {
    getRepository().saveOrUpdate(t);
  }
}